import {getRequest, postRequest, putRequest,deleteRequest} from "@/utils/request_utils";

export default {

  /**
   * 页面初始化数据
   */
  initView: () =>
    getRequest(`~/goods/init`),
  /**
   * 查询发货信息列表
   */
  findGoodsList: (params) =>
    getRequest(`~/goods/getGoodsList`, {params}),
  /**
   * 查询发货信息列表 split
   */
  findGoodsListSplit: (params) =>
    getRequest(`~/goods/getGoodsListSplit`, {params}),

  getDeliverInfo:(params)=>
    getRequest(`~/goods/getDeliverInfo`, {params}),

  //根据物料code获取 物料的供应商信息 单位 等
  selectMaterialInfo:(params)=>
    getRequest(`~/goods/selectMaterialInfo`, {params}),


  /***根据id确认发货*/
  sendGoods:(data)=>
    putRequest(`~/goods/sendGoods` ,{data}),

  /***根据id确认发货*/
  receivingGoods:(data)=>
    putRequest(`~/goods/receivingGoods` ,{data}),

  // 删除一组数据
  deleteByIds:(data)=>
    putRequest(`~/goods/deleteGoods` ,{data}),

  // 根据主键修改一条数据
  updateGoods:(data)=>
    putRequest(`~/goods/updateGoods`, {data}),
  // 添加一条数据
  addGoods:(data)=>
    postRequest(`~/goods/addGoods`, {data}),
  /**数据导出**/
  exportData:(params) =>
    postRequest(`~/goods/exportData`,{params,responseType:'blob'}),

  /**根据合同号获得 提单号、装船日期、船期、应付款日期、实际付款日期*/
  initInfoByContractNo:(params)=>
    getRequest(`~/goods/initInfoByContractNo`, {params}),

  // 拆分数据
  splitGoods:(data)=>
    postRequest(`~/goods/split/`+data.id, {data:data.tDeliverInfoEntity}),
}
